package com.cat.controller;

import com.cat.pojo.Customs;
import com.cat.service.CusService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Controller
public class CusController {
    @Resource
    private CusService cusService;
    @PostMapping("/tologin")
    @ResponseBody
    public Customs login(@RequestBody Customs customs){
        System.out.println(customs);
       Customs customs1 = cusService.login(customs.getCus_name(), customs.getCus_pass());
//        if(customs1!=null){
//            return true;
//        }

        return customs1;
    }
    @PostMapping("/saveCustoms")
    @ResponseBody
    public boolean saveCustoms(@RequestBody Customs customs){
        System.out.println(customs);

        return  cusService.saveCustoms(customs);

    }
    @PostMapping("/updateCustoms")
    @ResponseBody
    public boolean updateCustoms(@RequestBody Customs customs){
        System.out.println(customs);
        return cusService.updateCustoms(customs);

    }
    @PostMapping("/getCusByid/{cus_id}")
    @ResponseBody
    public Customs getCusByid(@PathVariable("cus_id") int id){
        return cusService.getCusByid(id);
    }
}
